package cn.itcast.crm.service;

import java.util.List;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

//编写服务类接口  
import cn.itcast.crm.domain.Customer;

//@Path("/cus")   //可以不写,避免和applicationContext.xml中的address重复

/*
 * 访问路径:http://localhost:9002/crm_management/services/customerService/customer
 * 路径1:http://localhost:9002/crm_management/
 * 路径2:web.xml中CXFService配置的路径              /services/*
 * 路径3:applicationContext.xml中的路径         address="/customerService"
 * 路径4:服务类上的路径    因为重复   注销了   故这里忽略
 * 路径5:方法上的路径   @Path("/customer")
 */
public interface CustomerServcie {
//查询所有未关联 客户列表
	@Path("/noassociationcustomers")
	@GET
	@Produces({"application/xml","application/json"})
	public List<Customer> findNoAssociationCustomer();
	
	//查询  已关联到指定定区的客户 列表 
	@Path("/associationfixedareacustomers/{fixedareaid}")
	@GET
	@Consumes({"application/xml","application/json"})
	@Produces({"application/xml","application/json"})
	public List<Customer> findHasAssociationFixedAreaCustomers(@PathParam("fixedareaid") String fixedareaid);
	
	//将客户关联到定区上,将所有客户id 拼成字符串,并用,间隔   
	@Path("/associationcustomerstofixedarea")
	@PUT
	public void associationCustomersToFixedArea(@QueryParam("customerIdStr") String customerIdStr,
			@QueryParam("fixedAreaId") String fixedAreaId);
	
	//前台页面   用户注册
	@Path("/customer")
	@POST
	@Consumes({"application/xml","application/json"})
	public void regist(Customer customer);
	
	//根据电话号码查询用户
	@Path("/customer/telephone/{telephone}")
	@GET
	@Consumes({"application/xml","application/json"})
	@Produces({"application/xml","application/json"})
	public Customer findByTelephone(@PathParam("telephone") String telephone);
	
	//修改客户信息
		@Path("/customer/updateType/{telephone}")
		@GET
		public void updateType(@PathParam("telephone") String telephone);
}


















